package com.webshop.domain;

import java.util.List;

public class Business {
    public static int idn = 0;
    String items = "";



    String nums = "";
    String username;
    double sum;
    int id;

    public String getItems() {
        return items;
    }

    public void setItems(String items) {
        this.items = items;
    }

    @Override
    public String toString() {
        return "Business{" +
                "items='" + items + '\'' +
                ", nums='" + nums + '\'' +
                ", username='" + username + '\'' +
                ", sum=" + sum +
                ", id=" + id +
                '}';
    }

    public String getNums() {
        return nums;
    }

    public void setNums(String nums) {
        this.nums = nums;
    }

    public double getSum() {
        return sum;
    }

    public void setSum(double sum) {
        this.sum = sum;
    }

    public int getId() {
        return id;
    }


    public void setId(int id) {
        this.id = id;
    }
    public Business(String username){
        id = ++idn;
        this.username = username;
    }

    public Business() {
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void addCart(List<Cart> carts){
        double sum = 0;
        for (Cart cart:carts){
            items = cart.getId()+"#"+items;
            nums = cart.getNum()+"#"+nums;
            sum+=cart.items.getPprice()*cart.getNum();
        }
        this.sum = sum;
    }
}
